package com.yuan.springcloud.user.utils;

import com.yuan.springcloud.user.bean.po.UserPO;
import com.yuan.springcloud.user.bean.vo.UserVO;
import com.yuan.springcloud.user.utils.transform.UserSignTrans;
import com.yuan.springcloud.user.utils.transform.UserTrans;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * 基于MapStruct框架的公共对象转换类
 * 使用方式：
 *  1. 通过Spring自动注入@Autowired Transform transform;
 *  2. 使用Transform.INSTANCE
 *
 * 当原对象与目标对象有不同名字的属性要进行映射时，需要通过 @Mapping 注解来具体的指定属性映射 @Mapping(source = "a", target = "b")
 * @author YouYuan
 * @date 2020/8/17 23:18
 */
@Mapper(componentModel = "spring")
public interface Transform {

    Transform INSTANCE = Mappers.getMapper(Transform.class);

    UserTrans user = Mappers.getMapper(UserTrans.class);

    UserSignTrans userSign = Mappers.getMapper(UserSignTrans.class);

}
